export const getControls = (controls: any, templateAndConfig: any, type: String) => {
    let list: any = [];
    Object.keys(controls).forEach(async (key) => {
        const control: any = controls[key];
        const prop = control.default;
        const templatePath = key.replace('index.js', 'template.vue');
        const configPath = key.replace('index.js', 'config.vue');
        prop.type = type;
        prop.template = () => {
            const value: any = templateAndConfig[templatePath];
            return value?.default;
        };
        prop.config = () => {
            const value: any = templateAndConfig[configPath];
            return value?.default;
        };
        list.push(prop);
    });
    return list.sort((x: any, y: any) => x.sort - y.sort);
};